Repository navigation
fix(plugin-form): drawer, tabbed and wizard edit forms for a record that does not exist show the not-found state, not an empty editable form - #29351
Merged
Conversation
…hat does not exist show the not-found state A null findOne answer in edit mode is a RecordNotFoundError, as in ModalForm, and every record form draws it through one shared RecordNotFoundState in loadFailure.ts instead of seeding an empty editable form. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTeZsth6vzGnL4eoaN
… record Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTeZsth6vzGnL4eoaN
… layout Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTeZsth6vzGnL4eoaN
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTeZsth6vzGnL4eoaN
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTeZsth6vzGnL4eoaN
This was referenced Nov 2, 2026
Contributor
Author
|
domain:ui#3 · zhuangjianguo · session_01QsR2jV4dWohojjbTJTQq5m 席位核对 · ACCEPT · 2026-11-02T12:57ZHead-sha:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steedos · project thread
Fixes #29247
Clause-②: no
Metadata-protocol: none
Declarations as set by the claim (card comment 6576081714), which fixes the file surface:
DrawerForm.tsx,TabbedForm.tsx,WizardForm.tsx,loadFailure.ts(a module-private shared helper only),ModalForm.tsxonly because its not-found drawing moved into that helper, their tests and a root changeset.维护者速读
?form=弹窗相同的文案),不再显示可编辑的空白表单,也没有「更新」按钮。四种记录表单共用loadFailure.ts里同一个私有组件来画这个状态。新建和编辑已存在的记录不变。findOne返回null时记一次RecordNotFoundError加载失败、不再把{}填进表单;原有的「加载失败时不画表单和底栏」路径接管其余。表单打开期间后台重读发现记录已删,也显示同一状态。ModalForm只是改为调用共享组件,行为不变。回滚即还原本 PR。ui/packages/plugin-form/src/loadFailure.ts末尾的RecordNotFoundState;DrawerForm.tsx记录读取 effect 的data == null分支与renderContent开头的分支;WizardForm.tsx同一处(它还设置persistedRecord)。pnpm --dir ui exec vitest run packages/plugin-form/src/recordNotFound-29247.test.tsx packages/plugin-form/src/ModalForm.recordNotFound-29157.test.tsx,预期 2 个文件、16 个测试全绿。What changes
DataSource.findOneis typedT | null, and the ObjectStack adapter'sreadOneanswersnullwhen the server answers 404.DrawerForm,TabbedFormandWizardFormransetFormData(data || {})(the wizard alsosetPersistedRecord(data || {})) and committed, so an edit form for a deleted or unknown record drew a blank editable form with an enabled Update button. Each now fails the read with the package-privateRecordNotFoundError, through the per-read failure run every other load failure uses, and the form is not seeded. This is the branch PR fix(plugin-form): the ?form overlay for a record that does not exist shows the not-found state, not an empty editable form #29246 gaveModalForm.loadFailure.tsgains a module-privateRecordNotFoundState:EmptywithEmptyTitleandEmptyDescription, reading the existing pack keysempty.recordNotFoundandempty.recordNotFoundDescriptionthrough its owncreateSafeTranslationtable (theenvalues, so a provider-less host still reads English). Each of the four layouts draws it ahead of the generic "Error loading form" box when the shown failure is aRecordNotFoundError; the drawer keeps its footer off while a load failure is shown, as before, and the tabbed and wizard layouts return the state in place of the form.ModalForm's inline copy of the same drawing and its two table rows move into the helper; its test id is kept.useRecordInvalidation) that finds the record deleted while the form is open shows the same state.Why
A user who opens an old link to a deleted record in a drawer, tabbed or wizard form saw a blank form, filled it in, and learned the record did not exist only on save.
Tests
recordNotFound-29247.test.tsx, onedescribe.eachoverDrawerForm,TabbedFormandWizardForm(each anobject-formin edit mode with one section, the real registered fields): anullread draws "Record not found", its description and the layout's test id, with notitleinput, no Update button and no "Error loading form"; a found record that a bus re-read then finds deleted switches to the same state; CONTROL a found record still draws its form and Update; CONTROL a create draws an empty form with Create and never callsfindOne.ModalForm.recordNotFound-29157.test.tsx(unchanged) holdsModalFormafter its drawing moved into the helper.Acceptance notes
findOneanswer down; the adapter's 404 tonullmapping is read fromObjectStackAdapter.readOne, not re-exercised.createElementbecauseloadFailure.tsstays a.tsmodule as the claim names it; thedata-testidprop is typed ontoEmpty's props instead of cast.setFormData(data)in the three layouts: after thenullbranch the|| {}fallback could no longer fire, so it is dropped.ModalForm's own line is left as it is.no-explicit-anyon the parametrised layout type), the same documented shape and reason asrecordSwapLoading.test.tsx: the four layouts share no props base.Verification
New pin · 12/12 here, the 6 not-found cases red against main's three layouts
pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-form/src/recordNotFound-29247.test.tsx packages/plugin-form/src/ModalForm.recordNotFound-29157.test.tsxunderos-verify-lockatc4c659f5: Test Files 2 passed (2), Tests 16 passed (16).Reverse check at
35a69884:DrawerForm.tsx,TabbedForm.tsxandWizardForm.tsxrestored from the basec347d22dwithgit restore --source(on disk:RecordNotFoundErrorcount 0 in each;data || {}count 1, 1 and 2),loadFailure.tskept at HEAD, new test file alone: Tests 6 failed, 6 passed (12). All six failures were the two not-found cases of each layout, each "Unable to find an element with the text: Record not found"; all six CONTROLs passed. Restored withgit restore --source=HEAD --staged --worktreeunder an EXIT trap;git diff HEADempty,git status --porcelainempty, and each file'sgit hash-objectequal to its HEAD blob.At the final head
56a7a05d(after the second merge ofmain): the two not-found files plusModalForm.untypedRepeater.test.tsx(new on main) andrecordSwapLoading.test.tsx: Test Files 4 passed (4), Tests 33 passed (33).plugin-form package, type check and lint
pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-form/(locked) at903d4662: Test Files 220 passed (220), Tests 2435 passed, 1 skipped. Same counts at35a69884before the first merge.turbo run type-check --filter=@object-ui/plugin-form(tsc --noEmit && tsc -p tsconfig.test.json): exit 0 at903d4662and again at56a7a05d. The first run, at35a69884, before815181c6typed the test id prop, was red with TS2769 oncreateElement(Empty, { 'data-testid' … }); fixed by naming the attribute in the props type, no cast.eslinton the six changed.ts/.tsxfiles: 0 errors; the one warning in a changed hunk is the documentedanyin the new test.pnpm --dir ui run check:new-line-citations: 0 new citations.node scripts/check-i18n-call-site-keys.mjs(fromui/, at35a69884): exit 0, the newcreateSafeTranslationtable repeats theenvalues.Derived gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 34 commands (the same 34 against merge basesc347d22dandd9885f5d). At903d4662, the 33 non-vitest gates ran in one loop and all exited 0,check-sdui-manifest.mjsand its--self-test,check:nul-bytes,check:query-options-erasure,check:type-check-debtandcheck:test-source-aliasamong them;pnpm --dir ui exec vitest run scripts/: Test Files 169 passed, 2 skipped; Tests 4903 passed, 2 skipped.dispatch-gates --ran: 34 derived, 34 run, 0 NOT-MEASURED.mainthen moved 21 commits, none touching the changed files (one newModalFormtest file and oneenkey in plugin-form and i18n). After merging it, at56a7a05d:check-sdui-manifest,check-changeset-no-major,check-adr-0087-registration,check-empty-changeset,check:nul-bytes,check:type-check-debt,check:type-check-coverage,check:test-source-alias,check:cross-package-test-inputs,check:undeclared-dep-importsandcheck:published-filesall exit 0. The other 23 derived gates were last measured at903d4662.Human Minimum
packages/specholds no runtime logic. (no spec change)pnpm lintpasses. (eslint on the changed files: 0 errors)main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code